#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#define max 100000   //随机生成最大的数为100
#define min 0    //随机生成最小的数为50
#define length  10000 // 数组长度
#define true 1
#define false 0
typedef char bool;
struct TreeNode{ int val;
    struct TreeNode *left;
    struct TreeNode *right;};

//定义结构体指针
typedef struct TreeNode *BTree;

//main.c的函数
int* generate_random_array();
void print_array(int array[]);
bool is_orderly(int array[]);
BTree CreateBTree();

//外部函数
void insertion_sort(int *);
void select_sort_Halved_find(int *);
void popupSort(int *);
void selectSort(int *);
void ShellSort(int *);
void quickSort(int *, int, int);
int* PreOrder(struct TreeNode*);


void main()
{
    //排序
    //int a[] = {7, 6, 2222, 20, 100, 9, 2, 1, 3, 5};
    //int *array = generate_random_array();
    //print_array(array);
    //quickSort(array, 0, length);
    //print_array(array);
    //bool res = is_orderly(array);
    //printf("%d", res);





}

BTree CreateBTree(){
    BTree T;

}


//BTree CreateBTree() {
//    char ch;
//    BTree T;
//    scanf("%c", &ch);
//    if(ch == '#'){
//        printf("create is end");
//        T =  NULL;
//    } else{
//        T = (BTree)malloc(sizeof(struct TreeNode));
//        T->val = ch;
//        printf("val is %c \n", ch);
//        T->left = CreateBTree();
//        T->right = CreateBTree();
//
//    }
//    return T;
//}
































int* generate_random_array(){
    static int array[length];
    srand((unsigned)time( NULL ));
    //printf("generate random array is :\n");
    for(int i=0; i<length; i++){
        array[i] = rand() % (max - min) + min;
        //printf("%d ", array[i]);
    }
    //printf("\n");
    return &(*array);
}

void print_array(int array[]){
    for(int i=0; i<length; i++){
        printf("%d ", array[i]);

    }
    printf("\n");
}

bool is_orderly(int array[]){
    for(int i=1; i<length; i++){
        if(array[i] < array[i-1]){
            return false;
        }
    }
    return true;
}